<!DOCTYPE html>
<title>Media Controls: fullscreen button accessibility tests</title>
<script src="../../fullscreen/full-screen-test.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-controls.js"></script>
<video controls></video>
<script>
async_test(t => {
  var video = document.querySelector('video');
  video.src = '../content/test.ogv';

video.oncanplaythrough = t.step_func_done(_ => {

    var fullscreen_button = fullscreenButton(video);
    assert_not_equals(fullscreen_button, null);

    assert_equals(fullscreen_button.getAttribute('aria-label'),
                  'enter full screen');
    runWithKeyDown(function() { video.webkitRequestFullscreen(); });

    video.onwebkitfullscreenchange = t.step_func(function() {
      assert_equals(fullscreen_button.getAttribute('aria-label'),
                    'exit full screen');

      runWithKeyDown(function() { video.webkitRequestFullscreen(); });

      video.onwebkitfullscreenchange = t.step_func(function() {
        assert_equals(fullscreen_button.getAttribute('aria-label'),
                      'enter full screen');
      });
    });
  });
});
</script>
